package com.eshop.we.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.eshop.we.business.LeaseOrderBusiness;
import com.eshop.we.leaseorder.entity.LeaseOrder;
import com.eshop.we.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/leaseorder")
public class LeaseOrderController extends BaseController {

    @Autowired
    LeaseOrderBusiness leaseOrderBusiness;

    @GetMapping("/getorderpage")
    public Result getLeaseOrderPage(@RequestParam(required = false)String orderNum,@RequestParam(required = false)String providerName,
                                    @RequestParam(required = false)String consumerName,@RequestParam(required = false)String startDate,
                                    @RequestParam(required = false)String endDate,@RequestParam(required = false)Integer status,
                                    @RequestParam(required = false,defaultValue = "1")Integer pageNum,@RequestParam(required = false,defaultValue = "20")Integer pageSize){

        Page page=new Page<LeaseOrder>(pageNum,pageSize);
        page=leaseOrderBusiness.selectLeaseOrderPage(page,orderNum,providerName,consumerName,startDate,endDate,status);
        return Result.success(page);
    }
}
